package com.shenmazong.proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @program: server-java-demo
 * @description: MarryInvocation
 * @author: 亮子说编程
 * @create: 2020-10-15 14:50
 **/
public class MarryInvocationHandler implements InvocationHandler {

    Object target;

    public MarryInvocationHandler(Object target) {
        this.target = target;
    }

    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {

        System.out.println("Before invoke "  + method.getName());
        method.invoke(target, args);
        System.out.println("After invoke " + method.getName());

        return null;
    }
}
